<?php
// logic:
// * The first parents left_field must be = to it's id and 0 (unless set otherwise).
// * The first parent right_field must be = this parent last child id + 1
// * The first child left_field must be = the parent id + 1
// * The first child right_field must be = its' left field + 1
// * Each progressive childs left_field must = the previous childs right_field
// * Each progressive childs right_field must = this childs left_field + 1
// * Each progressive parents left_field must = the previous Parents last childs' left_field + 1
// * Each progressive parents right_field must = its' left_field + 1
//As an additional note the level_field is for "indentation"…  0 = baseline, 1 indent = 1 space, 2 = indent 2 spaces…

$menuStr="";
$menuStr.="<rows>";
$menuStr.="<page>1</page>";
$menuStr.="<total>1</total>";
$menuStr.="<records>1</records>";
if($user->hasCredential("app_order_manager")) {
    $menuStr.="<row><cell>10000</cell><cell>订单/生产单管理</cell><cell></cell><cell>0</cell><cell>10000</cell><cell>11000</cell><cell>false</cell><cell>false</cell></row>";
    $menuStr.="<row><cell>10001</cell><cell>订单新建列表</cell><cell>customerOrder/index</cell><cell>1</cell><cell>10001</cell><cell>10002</cell><cell>true</cell><cell>true</cell></row>";
    if($user->hasCredential("app_customer_order_audit")) {
        $menuStr.="<row><cell>10002</cell><cell>订单已审批列表</cell><cell>customerOrder/getAuditedList</cell><cell>1</cell><cell>10001</cell><cell>10002</cell><cell>true</cell><cell>true</cell></row>";
    }
    $menuStr.="<row><cell>10005</cell><cell>生产单新建列表</cell><cell>productionOrder/index</cell><cell>1</cell><cell>10001</cell><cell>10002</cell><cell>true</cell><cell>true</cell></row>";
    if($user->hasCredential("app_production_order_audit")) {
        $menuStr.="<row><cell>10006</cell><cell>生产单已审批列表</cell><cell>productionOrder/getAuditedList</cell><cell>1</cell><cell>10001</cell><cell>10002</cell><cell>true</cell><cell>true</cell></row>";
    }
}
if($user->hasCredential("app_cotton_order_manager")) {
    $menuStr.="<row><cell>11001</cell><cell>棉纱单管理</cell><cell></cell><cell>0</cell><cell>11001</cell><cell>12000</cell><cell>false</cell><cell>false</cell></row>";
    $menuStr.="<row><cell>11002</cell><cell>棉纱单新建列表</cell><cell>cottonOrder/index</cell><cell>1</cell><cell>11002</cell><cell>11003</cell><cell>true</cell><cell>true</cell></row>";
    if($user->hasCredential("app_cotton_order_audit")) {
        $menuStr.="<row><cell>11003</cell><cell>棉纱单已审批列表</cell><cell>cottonOrder/getAuditedList</cell><cell>1</cell><cell>11002</cell><cell>11003</cell><cell>true</cell><cell>true</cell></row>";
    }
}
if($user->hasCredential("app_dye_order_manager")) {
    $menuStr.="<row><cell>12001</cell><cell>浆染纱管理</cell><cell></cell><cell>0</cell><cell>12001</cell><cell>13000</cell><cell>false</cell><cell>false</cell></row>";
    $menuStr.="<row><cell>12002</cell><cell>生产管理</cell><cell></cell><cell>1</cell><cell>12002</cell><cell>12500</cell><cell>false</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>12003</cell><cell>浆染纱生产新建列表</cell><cell>dyeOrder/index</cell><cell>2</cell><cell>12003</cell><cell>12004</cell><cell>true</cell><cell>true</cell></row>";
    if($user->hasCredential("app_dye_order_audit")) {
        $menuStr.="<row><cell>12004</cell><cell>浆染纱生产已审批列表</cell><cell>dyeOrder/getAuditedList</cell><cell>2</cell><cell>12003</cell><cell>12004</cell><cell>true</cell><cell>true</cell></row>";
    }
    $menuStr.="<row><cell>12501</cell><cell>出仓管理</cell><cell></cell><cell>1</cell><cell>12501</cell><cell>12999</cell><cell>false</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>12502</cell><cell>浆染纱出仓新建列表</cell><cell>dispatchOrder/DyeNewListIndex</cell><cell>2</cell><cell>12502</cell><cell>12503</cell><cell>true</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>12503</cell><cell>浆染纱出仓已审批列表</cell><cell>dispatchOrder/DyeAuditedListIndex</cell><cell>2</cell><cell>12502</cell><cell>12503</cell><cell>true</cell><cell>true</cell></row>";
}
if($user->hasCredential("app_weave_order_manager")) {
    $menuStr.="<row><cell>13001</cell><cell>织造布管理</cell><cell></cell><cell>0</cell><cell>13001</cell><cell>14000</cell><cell>false</cell><cell>false</cell></row>";
    $menuStr.="<row><cell>13002</cell><cell>生产管理</cell><cell></cell><cell>1</cell><cell>13002</cell><cell>13500</cell><cell>false</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>13003</cell><cell>织造布生产新建列表</cell><cell>weaveOrder/index</cell><cell>2</cell><cell>13003</cell><cell>13004</cell><cell>true</cell><cell>true</cell></row>";
    if($user->hasCredential("app_weave_order_audit")) {
        $menuStr.="<row><cell>13004</cell><cell>织造布生产已审批列表</cell><cell>weaveOrder/getAuditedList</cell><cell>2</cell><cell>13003</cell><cell>13004</cell><cell>true</cell><cell>true</cell></row>";
    }
    $menuStr.="<row><cell>13501</cell><cell>出仓管理</cell><cell></cell><cell>1</cell><cell>13501</cell><cell>13999</cell><cell>false</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>13502</cell><cell>织造布出仓新建列表</cell><cell>dispatchOrder/WeaveNewListIndex</cell><cell>2</cell><cell>13502</cell><cell>13503</cell><cell>true</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>13503</cell><cell>织造布出仓已审批列表</cell><cell>dispatchOrder/WeaveAuditedListIndex</cell><cell>2</cell><cell>13502</cell><cell>13503</cell><cell>true</cell><cell>true</cell></row>";
}
//if($user->hasCredential("app_weave_qc_form_manager")) {
//    $menuStr.="<row><cell>14001</cell><cell>织造QC单管理</cell><cell></cell><cell>0</cell><cell>14001</cell><cell>15000</cell><cell>false</cell><cell>false</cell></row>";
//    $menuStr.="<row><cell>14002</cell><cell>织造QC单列表</cell><cell>weaveQcForm/index</cell><cell>1</cell><cell>14002</cell><cell>14003</cell><cell>true</cell><cell>true</cell></row>";
//}
if($user->hasCredential("app_clean_up_form_manager")) {
    $menuStr.="<row><cell>15001</cell><cell>后整布管理</cell><cell></cell><cell>0</cell><cell>15001</cell><cell>16000</cell><cell>false</cell><cell>false</cell></row>";
    $menuStr.="<row><cell>15002</cell><cell>生产管理</cell><cell></cell><cell>1</cell><cell>15002</cell><cell>15500</cell><cell>false</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>15003</cell><cell>后整布生产新建列表</cell><cell>cleanUpForm/index</cell><cell>2</cell><cell>15003</cell><cell>15004</cell><cell>true</cell><cell>true</cell></row>";
    if($user->hasCredential("app_clean_up_form_audit")) {
        $menuStr.="<row><cell>15004</cell><cell>后整布生产已审批列表</cell><cell>cleanUpForm/getAuditedList</cell><cell>2</cell><cell>15003</cell><cell>15004</cell><cell>true</cell><cell>true</cell></row>";
    }
    $menuStr.="<row><cell>15501</cell><cell>出仓管理</cell><cell></cell><cell>1</cell><cell>15501</cell><cell>15999</cell><cell>false</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>15502</cell><cell>后整布出仓新建列表</cell><cell>dispatchOrder/CleanUpNewListIndex</cell><cell>2</cell><cell>15502</cell><cell>15503</cell><cell>true</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>15503</cell><cell>后整布出仓已审批列表</cell><cell>dispatchOrder/CleanUpAuditedListIndex</cell><cell>2</cell><cell>15502</cell><cell>15503</cell><cell>true</cell><cell>true</cell></row>";
}
if($user->hasCredential("app_final_cloth_qc_form_manager")) {
//    $menuStr.="<row><cell>16001</cell><cell>后整QC单管理</cell><cell></cell><cell>0</cell><cell>16001</cell><cell>17000</cell><cell>false</cell><cell>false</cell></row>";
//    $menuStr.="<row><cell>16002</cell><cell>后整QC单列表</cell><cell>cleanUpQcForm/index</cell><cell>1</cell><cell>16002</cell><cell>16003</cell><cell>true</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>16001</cell><cell>成品布QC管理</cell><cell></cell><cell>0</cell><cell>16001</cell><cell>17000</cell><cell>false</cell><cell>false</cell></row>";
    $menuStr.="<row><cell>16002</cell><cell>成品布测试管理</cell><cell></cell><cell>1</cell><cell>16002</cell><cell>16500</cell><cell>false</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>16003</cell><cell>测试单新建列表</cell><cell>finalClothQcTestForm/index</cell><cell>2</cell><cell>16003</cell><cell>16004</cell><cell>true</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>16004</cell><cell>测试单已审批列表</cell><cell>finalClothQcTestForm/getAuditedList</cell><cell>2</cell><cell>16003</cell><cell>16004</cell><cell>true</cell><cell>true</cell></row>";

    $menuStr.="<row><cell>16501</cell><cell>成品布检验包装管理</cell><cell></cell><cell>1</cell><cell>16501</cell><cell>16999</cell><cell>false</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>16502</cell><cell>检验包装单新建列表</cell><cell>finalClothQcWrapperForm/index</cell><cell>2</cell><cell>16502</cell><cell>16503</cell><cell>true</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>16503</cell><cell>检验包装单已审批列表</cell><cell>finalClothQcWrapperForm/getAuditedList</cell><cell>2</cell><cell>16502</cell><cell>16503</cell><cell>true</cell><cell>true</cell></row>";
}
if($user->hasCredential("app_final_cloth_form_manager")) {
    $menuStr.="<row><cell>17001</cell><cell>成品布管理</cell><cell></cell><cell>0</cell><cell>17001</cell><cell>18000</cell><cell>false</cell><cell>false</cell></row>";
    $menuStr.="<row><cell>17002</cell><cell>生产管理</cell><cell></cell><cell>1</cell><cell>17002</cell><cell>17500</cell><cell>false</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>17003</cell><cell>成品生产单新建列表</cell><cell>finalClothForm/index</cell><cell>2</cell><cell>17003</cell><cell>17004</cell><cell>true</cell><cell>true</cell></row>";
    if($user->hasCredential("app_final_cloth_form_audit")) {
        $menuStr.="<row><cell>17004</cell><cell>成品布生产已审批列表</cell><cell>finalClothForm/getAuditedList</cell><cell>2</cell><cell>17003</cell><cell>17004</cell><cell>true</cell><cell>true</cell></row>";
    }
    $menuStr.="<row><cell>17501</cell><cell>出仓管理</cell><cell></cell><cell>1</cell><cell>17501</cell><cell>17999</cell><cell>false</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>17502</cell><cell>成品布出仓新建列表</cell><cell>dispatchOrder/FinalClothNewListIndex</cell><cell>2</cell><cell>17502</cell><cell>17503</cell><cell>true</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>17503</cell><cell>成品布出仓已审批列表</cell><cell>dispatchOrder/FinalClothAuditedListIndex</cell><cell>2</cell><cell>17502</cell><cell>17503</cell><cell>true</cell><cell>true</cell></row>";
}
if($user->hasCredential("app_statistic_manage")) {
    $menuStr.="<row><cell>18001</cell><cell>查询与统计</cell><cell></cell><cell>0</cell><cell>18001</cell><cell>19000</cell><cell>false</cell><cell>false</cell></row>";
    $menuStr.="<row><cell>18002</cell><cell>工厂库存列表</cell><cell>statistic/statisticFactory</cell><cell>1</cell><cell>18002</cell><cell>18003</cell><cell>true</cell><cell>true</cell></row>";
//    $menuStr.="<row><cell>18003</cell><cell>生产统计图</cell><cell>statistic/getStatsChart</cell><cell>1</cell><cell>18002</cell><cell>18003</cell><cell>true</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>18003</cell><cell>生产统计图</cell><cell>statistic/produceStatsChart</cell><cell>1</cell><cell>18002</cell><cell>18003</cell><cell>true</cell><cell>true</cell></row>";
    $menuStr.="<row><cell>18004</cell><cell>物料进出明细项</cell><cell>stockGoodsStatement/index</cell><cell>1</cell><cell>18002</cell><cell>18003</cell><cell>true</cell><cell>true</cell></row>";
}
$menuStr.="</rows>";
echo $menuStr;
?>